<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head lang="zh-cn">
    <meta charset="UTF-8"/>
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="apple-touch-fullscreen" content="yes"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    <meta name="format-detection" content="telephone=no"/>
    <meta name="description" content="厚和尚品"/>
    <meta name="keywords" content="厚和尚品"/>
    <title th:text="${title}">我的订单</title>
    <link rel="apple-touch-icon-precomposed" href=""/>
    <link rel="apple-touch-startup-image" href=""/>
    <link rel="stylesheet" href="mall/css/css.css" th:href="@{/mall/css/css.css}" />
    <script type="text/javascript" src="mall/lib/zpeto/zepto-1.2.0.min.js"
	th:src="@{/mall/lib/zpeto/zepto-1.2.0.min.js}"></script>
	<script type="text/javascript" src="mall/lib/layer/layer_mobile/layer.js" th:src="@{/mall/lib/layer/layer_mobile/layer.js}"></script>
    <script type="text/javascript" src="mall/js/comm.js"
	th:src="@{/mall/js/comm.js}"></script>
    <!--  引入jquery标签库  -->
    <script type="text/javascript" src="mall/js/jquery.cityselect.js" th:src="@{/mall/js/jquery.cityselect.js}"></script>
    <script type="text/javascript">
     	function orderPayment(orderId,orderStatus){
     			if(orderStatus==0){
     				location.href="/member/backPay?orderId="+orderId;
     			}
     			if(orderStatus==2){
     				$.ajax({
     					type:"post",
     					url:"/member/trackingNumberCheck",
     					data:"orderId="+orderId,
     					dataType:"json",
     					success:function(data){
     						if(data.success=="失败"){
     							alert("系统异常")
     						}
     						if(data.Success==true){
     							//获取快递公司的编码
     							var numberIdentification=(data.Shippers)[0].ShipperCode;
     							//获取物流单号
     							var trackingNumber=data.LogisticCode;
     							location.href="/member/trackingInformationCheck?companyCode="+numberIdentification+"&amp;number="+trackingNumber;
     						}else{
     								layer.open({
									content :'系统繁忙',
								//skin : 'msg',
									scrollbar: false,
									time : 2,
								//2秒后自动关闭
								});
								return ;
     						}
     						
     					}
     				})
     			}
    	 }
    </script>
   
    
</head>
<body>
<div class="order-list">
<!--  拿出每一个订单信息但是每一个订单信息包含一个订单详细的集合    -->
    <div class="item" th:if="${haveorder > 0}" th:each="orderInfo : ${orderList}">
    <div  id="div1"  th:onclick="'javascript:orderPayment(\''+${orderInfo.orderId}+'\',\''+${orderInfo.orderStatus}+'\')'">
    		<input type="hidden" th:value="${totalCount}" id="count"/>
    		<input type="hidden" th:value="${page}" id="count2"/>
        <div class="o-title-shop">
        <!--   0代表未支付  2代表已支付  -->
        	<div class="name" th:text="|订单编号：${orderInfo.orderId}|">店铺：厚和尚品</div>
            <div class="state" th:if="${orderInfo.orderStatus == 0}">待支付</div>
            <div class="state" th:if="${orderInfo.orderStatus == 1 }">交易失败</div>
            <div class="state" th:if="${orderInfo.orderStatus == 2}">已支付</div>
           <!--  <div class="state" th:if="${orderInfo.orderStatus == 2 and orderInfo.transferStatus == 0 }">待发货</div>
            <div class="state" th:if="${orderInfo.orderStatus == 2 and orderInfo.transferStatus == 2 }">已发货</div>--> 
        </div>
        <div class="o-number" th:text="|交易时间：${orderInfo.orderDate} ${orderInfo.orderTime}|">订单编号：1231413423412345134</div>
        <!-- 获取订单详细信息 -->
        <div class="o-item" th:each="itemInfo : ${orderInfo.itemList}">
            	<div class="goods2-img">
                	<img th:src="@{'/upload-dir/'+${itemInfo.productId}+'/min/' + ${itemInfo.smallImgPath}}" alt=""/>
            	</div>
           		 <div class="content2">
                	<p class="title" th:text="${itemInfo.proName}">老风农天然450g喝出健康</p>
                	<div class="item-pay">
               		 <!-- 获取当前订单详细的积分，金额 以及数量  -->
               		 <div class="price"><span class="ftx-01" th:text="${itemInfo.transBonus}">200</span>积分+￥<span
							class="ftx-01" th:text="${itemInfo.transAmt}">59</span></div>
                	<div class="quantity" th:text="|× ${itemInfo.count}|">×1</div>
            	</div>
          </div>
        </div>
        
        <!-- 显示当前订单的详细总的积分和金钱 -->
       			 	<div class="o-total-price" >合计：<span class="ftx-01" th:text="${orderInfo.transBonus}">200</span>积分+￥<span
						class="ftx-01" th:text="${orderInfo.transAmt}">59</span>
					</div>
		</div>
   	</div>
		<div class="ft-btn-wrap mui-flex ">
    		<div  class="cell"  >
				<button class="btn btn-green" type="submit" onclick="orderNextPage()">下一页</button>
			</div>
		</div>
</div>
		<div class="item" th:if="${haveorder == 0}">
        		<div class="o-title-shop">
        			<div class="name">暂无订单</div>
     			</div>
 		</div>
 
<div class="bottom-fxied" style="left: 0px; bottom: 0px; width: 100%; display: block;">
    <div class="footer-menu">
        <a th:href="@{/main/}" class="home"><img src="mall/img/ico-home-01.png" th:src="@{/mall/img/ico-home-01.png}" alt=""/></a>
        <a th:href="@{/main/list/all}" class="link-single">全部尚品</a>
        <a th:href="@{/member/main}" class="link-single">我的订单</a>
    </div>
</div>

<script type="text/javascript">
		//当前页
		var page=$("#count2").val();
		//获取总页数
		var pagesize=$("#count").val();
function orderNextPage(){
				page++;
			if(page==pagesize){
					page=0;
					location.href="/member/orderlist/all?page="+page;
			} if(pagesize>=page){
				location.href="/member/orderlist/all?page="+page;
			}if(page>pagesize){
				return ;			
			}
}
</script>
</body>
</html>